home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / fun / mgcstck.sit / Magic Stack / stack.txt < prev   
Encoding:
Text File  |  1991-09-04  |  19.5 KB  |  606 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 2
  11. -- first background id: 2760
  12. -- card count: 7
  13. -- first card id: 2847
  14. -- list block id: 2266
  15. -- print block id: 0
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 113280 bytes
  21. -- stack block size: 17920 bytes
  22. -- created by hypercard version: 0x01258000
  23. -- compacted by hypercard version: 0x01258000
  24. -- modified by hypercard version: 0x01258000
  25. -- opened by hypercard version: 0x01258000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x00103854FE543810
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openStack
  69.   if the version < 1.2 then
  70.     answer "Sorry. You need Hypercard 1.2 or greater for this stack."
  71.     go home
  72.   end if
  73.   hide bg btn "go back"
  74.   global MAINSCREEN,MAX_LEVEL,JUST_LIST,SpellBGID
  75.   put "From List" into JUST_LIST
  76.   put 9 into MAX_LEVEL
  77.   put the short id of cd "Main Screen" of bg "Magic Stack" into MAINSCREEN
  78.   put the short id of bg "Spells" into SpellBGID
  79.   set the textarrows to true
  80.   set userlevel to 3
  81.   set blindtyping to false
  82.   hide menubar
  83.   hide bg fld "help field"
  84.   set the hilite of bg btn "help" to false
  85. end openStack
  86.  
  87. function Field_Select
  88. put the clickloc into CLICKEDHERE
  89. put trunc((item 2 of CLICKEDHERE - Top of the target +the scroll of the target) div textHeight of the target) + 1 into theLine
  90.  
  91. set the locktext of the target to false
  92. click at the left of the target,item 2 of CLICKEDHERE
  93. click at the right of the target-18,item 2 of CLICKEDHERE with shiftkey
  94. set the locktext of the target to true
  95. return theLine
  96. end Field_Select
  97.  
  98. on work
  99.   show menubar
  100.   set userlevel to 5
  101.   set blindtyping to true
  102. end work
  103. on play
  104.   hide menubar
  105.   set userlevel to 3
  106.   choose browse tool
  107.  
  108. end play
  109.  
  110. on closestack
  111.   global MAINSCREEN
  112.   hide bg btn "go back" of cd id MAINSCREEN
  113.   if the freesize of this stack > size of this stack/10 then doMenu "Compact Stack"
  114. end closestack
  115.  
  116. function Add_List NEW_NAME,NEW_ID,NAME_FIELD,ID_FIELD
  117. put cd fld NAME_FIELD of cd "Lists" into ALPHA_NAMES
  118. put cd fld ID_FIELD of cd "Lists" into ALPHA_LINKS
  119. put 1 into COUNT
  120.  
  121. put BSearch (NEW_NAME,ALPHA_NAMES) into COUNT
  122.  
  123. if COUNT is 0 then
  124.   -- put it at the start of the list
  125.   if ALPHA_NAMES is not empty then
  126.     put return before line 1 of ALPHA_NAMES
  127.     put return before line 1 of ALPHA_LINKS
  128.   end if
  129.   put NEW_NAME into line 1 of ALPHA_NAMES
  130.   put NEW_ID into line 1 of ALPHA_LINKS
  131. else
  132.   -- put it within the list
  133.   put return&NEW_NAME after line COUNT of ALPHA_NAMES
  134.   put return&NEW_ID after line COUNT of ALPHA_LINKS
  135. end if
  136. put ALPHA_NAMES into cd fld NAME_FIELD of cd "Lists"
  137. put ALPHA_LINKS into cd fld ID_FIELD of cd "Lists"
  138. end Add_List
  139.  
  140. function Delete_List SPELL_NAME,SPELL_ID,NAME_FIELD,ID_FIELD
  141. put cd fld NAME_FIELD of cd "Lists" into ALPHA_NAMES
  142. put cd fld ID_FIELD of cd "Lists" into ALPHA_IDS
  143. put 1 into COUNT
  144.  
  145. put BSearch (SPELL_NAME,ALPHA_NAMES) into COUNT
  146.  
  147. if line COUNT of ALPHA_NAMES is not SPELL_NAME then
  148.   answer "You have a bad Magic Stack. Contact Me."
  149. else
  150.   if line COUNT of ALPHA_IDS is not SPELL_ID then
  151.     -- move around to find the correct SPELL_ID
  152.     repeat while line (COUNT-1) of ALPHA_NAMES is SPELL_NAME
  153.       subtract 1 from COUNT
  154.     end repeat
  155.     repeat while line COUNT of ALPHA_IDS is not SPELL_ID and line COUNT of ALPHA_NAMES is SPELL_NAME
  156.       add 1 to COUNT
  157.     end repeat
  158.     if line COUNT of ALPHA_NAMES is not SPELL_NAME then
  159.       answer "You have a bad Magic Stack. See Manual."
  160.     end if
  161.   end if
  162.   delete line COUNT of ALPHA_NAMES
  163.   delete line COUNT of ALPHA_IDS
  164. end if
  165. put ALPHA_NAMES into cd fld NAME_FIELD of cd "Lists"
  166. put ALPHA_IDS into cd fld ID_FIELD of cd "Lists"
  167. end Delete_List
  168.  
  169. function BSearch NAME,NAME_LIST
  170. -- find where NAME is, or if not there, where it should go
  171. -- this returns the line NAME should go AFTER is NAME is not there
  172. put 1 into MIN_BOUND
  173. put the number of lines of NAME_LIST into MAX_BOUND
  174. put trunc((MIN_BOUND+MAX_BOUND)/2) into TEST_SITE
  175. put MIN_BOUND into PREV_SITE
  176. if MAX_BOUND is 0 then
  177.   put 0 into TEST_SITE
  178. else if NAME < line MIN_BOUND of NAME_LIST then
  179.   put MIN_BOUND-1 into TEST_SITE
  180. else if NAME >= line MAX_BOUND of NAME_LIST then
  181.   put MAX_BOUND into TEST_SITE
  182. else repeat until NAME=line TEST_SITE of NAME_LIST or TEST_SITE is PREV_SITE
  183. if NAME>line TEST_SITE of NAME_LIST then
  184.   put TEST_SITE into MIN_BOUND
  185. else
  186.   put TEST_SITE into MAX_BOUND
  187. end if
  188. put TEST_SITE into PREV_SITE
  189. put trunc((MIN_BOUND+MAX_BOUND)/2) into TEST_SITE
  190. end repeat
  191. return TEST_SITE
  192. end BSearch
  193.  
  194.  
  195. function Find_Junk WHAT,WHERE,TYPE,TYPE_TO_SEARCH
  196. global NAME_LIST,ID_LIST
  197. put 1 into SPELL_COUNT
  198. repeat while SPELL_COUNT <= the number of lines of ID_LIST
  199.   put line SPELL_COUNT of ID_LIST into SPELL_ID
  200.   if TYPE is not "All Types" then
  201.     put FALSE into KEEP_IT
  202.     put 1 into COUNT
  203.     repeat while COUNT <= the number of lines of TYPE and not KEEP_IT
  204.       put offset(line COUNT of TYPE,bg fld TYPE_TO_SEARCH of cd id SPELL_ID) is not 0 into KEEP_IT
  205.       add 1 to COUNT
  206.     end repeat
  207.   else put TRUE into KEEP_IT
  208.   if KEEP_IT then
  209.     put 1 into COUNT
  210.     if line COUNT of WHERE is "Used By" then
  211.       if line COUNT of WHAT is not "No one" then
  212.         put offset ("Anyone",bg fld (line COUNT of WHERE) of cd id SPELL_ID)is not 0 into KEEP_IT
  213.       end if
  214.       if offset (line COUNT of WHAT,bg fld (line COUNT of WHERE) of cd id SPELL_ID) is not 0 then
  215.         put TRUE into KEEP_IT
  216.       end if
  217.       put 2 into COUNT
  218.     end if
  219.     if KEEP_IT then
  220.       repeat while COUNT<= the number of lines of WHAT and KEEP_IT
  221.         put offset(line COUNT of WHAT,bg fld (line COUNT of WHERE) of cd id SPELL_ID) is not 0 into KEEP_IT
  222.         add 1 to COUNT
  223.       end repeat
  224.     end if
  225.   end if
  226.   if not KEEP_IT then
  227.     delete line SPELL_COUNT of ID_LIST
  228.     delete line SPELL_COUNT of NAME_LIST
  229.   else
  230.     add 1 to SPELL_COUNT
  231.   end if
  232. end repeat
  233. end Find_Junk
  234.  
  235. function Add_Chooser NEW_NAME,NEW_ID
  236. global MAINSCREEN,CURRENT_CARD
  237. put last char of bg fld "Spell Chooser" of cd id MAINSCREEN into SCH
  238. put last char of cd fld "SpellID" of cd id MAINSCREEN into SID
  239. if SCH is return or (bg fld "Spell Chooser" of cd id MAINSCREEN) is empty then
  240.   put empty into SCH
  241. else
  242.   put return into SCH
  243. end if
  244. if SID is return or (cd fld "SpellID" of cd id MAINSCREEN) is empty then
  245.   put empty into SID
  246. else
  247.   put return into SID
  248. end if
  249. put SCH&NEW_NAME after bg fld "Spell Chooser" of cd id MAINSCREEN
  250. put SID&(the short id of this card) after cd fld "SpellID" of cd id MAINSCREEN
  251. put the number of lines of bg fld "Spell Chooser" of cd id MAINSCREEN into CURRENT_CARD
  252. end Add_Chooser
  253.  
  254. function AskForLevel
  255. global MAX_LEVEL
  256. put TRUE into REPEATASK
  257. repeat while REPEATASK
  258.   ask "Spell Level?"
  259.   put it into NewLevel
  260.   if NewLevel is empty or NewLevel is "Cancel" then
  261.     put FALSE into REPEATASK
  262.   else if NewLevel < 1 or NewLevel > MAX_LEVEL then
  263.     answer "Level must be from 1 to"&&MAX_LEVEL
  264.   else if length(NewLevel) > 1 then
  265.     answer "I need a number for level."
  266.   else
  267.     put it into NewLevel
  268.     put FALSE into REPEATASK
  269.   end if
  270. end repeat
  271. return NewLevel
  272. end AskForLevel
  273.  
  274. on ShowHelp TheFIELD,Button
  275.   global MAINSCREEN
  276.   put cd fld TheFIELD of cd id MAINSCREEN into TheHELP
  277.   if TheHELP is not bg fld "Help Field" then
  278.     lock screen
  279.     --set the scroll of bg fld "Help Field" to 0
  280.     put the rect of bg fld "Help Field" into HELPRECT
  281.     if Button is FALSE then
  282.       put the bottom of bg fld TheFIELD into BTNBOTTOM
  283.       put the left of bg fld TheFIELD into BTNLEFT
  284.     else
  285.       put the bottom of bg btn TheFIELD into BTNBOTTOM
  286.       put the left of bg btn TheFIELD into BTNLEFT
  287.     end if
  288.     if BTNBOTTOM > 240 then
  289.       -- set the bottom to the bottom
  290.       add (BTNBOTTOM-item 4 of HELPRECT) to item 2 of HELPRECT
  291.       put BTNBOTTOM into item 4 of HELPRECT
  292.     else
  293.       -- set the top to the top
  294.       add (BTNBOTTOM-item 2 of HELPRECT) to item 4 of HELPRECT
  295.       put BTNBOTTOM into item 2 of HELPRECT
  296.     end if
  297.     if BTNLEFT > 250 then
  298.       -- set the right to the right
  299.       add (BTNLEFT-item 3 of HELPRECT) to item 1 of HELPRECT
  300.       put BTNLEFT into item 3 of HELPRECT
  301.     else
  302.       -- set the left to the left
  303.       add (BTNLEFT-item 1 of HELPRECT) to item 3 of HELPRECT
  304.       put BTNLEFT into item 1 of HELPRECT
  305.     end if
  306.     set the rect of bg fld "Help Field" to HELPRECT
  307.     put TheHELP into bg fld "Help Field"
  308.     unlock screen
  309.     beep
  310.   end if
  311.   show bg fld "Help Field"
  312. end ShowHelp
  313.  
  314. on cmdkey TheKEY
  315.   answer TheKEY
  316. end cmdkey
  317.  
  318. on arrowKey
  319.   put the textarrows into ARROWSAVE
  320.   if word 1 of the selectedChunk is "char" then
  321.     set the textarrows to true
  322.     pass arrowKey
  323.   end if
  324.   set the textarrows to ARROWSAVE
  325. end arrowKey
  326.  
  327.  
  328. function delField TheField
  329. put the userlevel into SavedLevel
  330. set the userlevel to 5
  331. select cd fld TheField
  332. domenu "clear field"
  333. choose browse tool
  334. set the userlevel to SavedLevel
  335. end delField
  336.  
  337.  
  338. -- This imports spells, and will also serve to Update for newer
  339. -- versions of the Magic Stack
  340. on Update OLD_ID,NEW_ID,OLDFIELDS,NEWFIELDS
  341.   repeat with COUNT=1 to the number of lines of OLDFIELDS
  342.     put line COUNT of OLDFIELDS into CURRENT_FIELD
  343.     if IsLineIn(CURRENT_FIELD,NEWFIELDS) then
  344.       put bg fld CURRENT_FIELD of cd id OLD_ID into bg fld CURRENT_FIELD of cd id NEW_ID
  345.     end if
  346.  
  347.   end repeat
  348. end Update
  349.  
  350. function IsLineIn TheLine,TheList
  351. put offset(TheLine,TheList) into TheLOC
  352. put space into EndChar
  353. put space into StartChar
  354. if TheLOC is not 0 then
  355.   put return into EndChar
  356.   put return into StartChar
  357.  
  358.   -- see if the start begins a line
  359.   if TheLOC > 1 then
  360.     put char (TheLOC-1) of TheLIST into StartChar
  361.   end if
  362.  
  363.   -- see if the end ends a line
  364.   if (TheLOC + length(TheLINE)) < length(TheLIST) then
  365.     put char (TheLOC+length(TheLINE)) of TheLIST into EndChar
  366.   end if
  367. end if
  368. put EndChar is return and StartChar is return into IsThere
  369. return IsThere
  370. end IsLineIn
  371.  
  372. -- this command adds the current card to the lists of spells
  373. -- don't forget that adding/changing a spell's class(es) does it's own
  374. --      specific version of this, just for the addition
  375. on ADD_THIS_CARD
  376.   put the short id of this card into NEW_ID
  377.   put bg fld "Name" into NEW_NAME
  378.   put bg fld "Level" into NEW_LEVEL
  379.   set the cantdelete of this card to false
  380.   put bg fld "Class" into NEW_CLASS
  381.   repeat with COUNT=1 to the number of items of NEW_CLASS
  382.     put item COUNT of NEW_CLASS into CLASS_NAME
  383.     put CLASS_NAME&"Alphabetical" into NAME_FIELD
  384.     put CLASS_NAME&&"Level"&&NEW_LEVEL into LEVEL_FIELD
  385.     put LEVEL_FIELD&&"IDs" into LEVEL_ID_FIELD
  386.     put CLASS_NAME&"AlphaLinkIDs" into ID_FIELD
  387.     get Add_List(NEW_NAME,NEW_ID,NAME_FIELD,ID_FIELD)
  388.     get Add_List(NEW_NAME,NEW_ID,LEVEL_FIELD,LEVEL_ID_FIELD)
  389.   end repeat
  390.   put "Level"&&NEW_LEVEL into LEVEL_FIELD
  391.   put LEVEL_FIELD&&"IDs" into LEVEL_ID_FIELD
  392.   get Add_List(NEW_NAME,NEW_ID,"Alphabetical","AlphaLinkIDs")
  393.   get Add_List(NEW_NAME,NEW_ID,LEVEL_FIELD,LEVEL_ID_FIELD)
  394.   get Add_Chooser(NEW_NAME,NEW_ID)
  395. end ADD_THIS_CARD
  396.  
  397. -- make sure all the classes that use this spell exist
  398. -- prompt user to 'add, delete, or replace' if it doesn't
  399. on CHECK_THIS_CARD NewClassList
  400.   global MAINSCREEN,REPLACE_LIST
  401.   put 1 into THERECLASS
  402.   repeat while THERECLASS <= the number of items of bg fld "Class"
  403.     put TRUE into NOPE_NOT_THERE
  404.     put bg fld "Class" into SPELLCLASSES
  405.     put cd fld "Classes" of cd "Lists" into TheCLASSES
  406.     put the number of lines of TheCLASSES into NUMCLASSES
  407.     put 1 into HERECLASS
  408.     repeat while NOPE_NOT_THERE and HERECLASS <= NUMCLASSES
  409.       put (item THERECLASS of SPELLCLASSES) is not (item 1 of (line HERECLASS of TheCLASSES)) into NOPE_NOT_THERE
  410.       add 1 to HERECLASS
  411.     end repeat
  412.     put TRUE into ADDONE
  413.     if NOPE_NOT_THERE then
  414.       -- it doesn't exist
  415.       put item THERECLASS of SPELLCLASSES into GHOSTCLASS
  416.       put Replacements(GHOSTCLASS) into TheCHOICE
  417.       if TheCHOICE is "Not Here" then
  418.         answer "Class"&&GHOSTCLASS&&"does not exist."
  419.         repeat with Count=1 to the number of lines of TheCLASSES -1
  420.           put item 1 of line Count of TheCLASSES into line Count of TheList
  421.         end repeat
  422.         repeat until TheCHOICE is "Create" or TheCHOICE is "Replace" or TheCHOICE is "Delete"
  423.           put empty into TheReplace
  424.           answer "Create, replace, or delete"&&GHOSTCLASS&"?" with "Create" or "Replace" or "Delete"
  425.           put it into TheCHOICE
  426.           if TheCHOICE is "Replace" then
  427.             dolist "Replace","Cancel",TheList,one
  428.             if the result is not empty then
  429.               put item 2 of the result into TheReplace
  430.               put "Replace,"&GHOSTCLASS&","&TheReplace into ADDITION
  431.               put ADDITION into line (the number of lines of REPLACE_LIST+1) of REPLACE_LIST
  432.             else
  433.               put empty into TheCHOICE
  434.             end if
  435.           else if TheCHOICE is "Delete" then
  436.             put "Delete,"&GHOSTCLASS into ADDITION
  437.             put ADDITION into line (the number of lines of REPLACE_LIST+1) of REPLACE_LIST
  438.           end if
  439.         end repeat
  440.         set the cursor to watch
  441.         RenewScreen MAINSCREEN
  442.       else
  443.         put item 2 of TheCHOICE into TheReplace
  444.         delete item 2 of TheCHOICE
  445.       end if
  446.       if TheCHOICE is "Delete" then
  447.         delete item THERECLASS of bg fld "Class"
  448.         put FALSE into ADDONE
  449.       else if TheCHOICE is "Create" then
  450.         Put 1 into NewClassNum
  451.         repeat until (item 1 of line NewClassNum of NewClassList) is GHOSTCLASS or NewClassNum> the number of lines of NewClassList
  452.           add 1 to NewClassNum
  453.         end repeat
  454.         if NewClassNum> the number of lines of NewClassList then
  455.           put "None" into NewType
  456.         else
  457.           put (item 2 of line NewClassNum of NewClassList) into NewType
  458.         end if
  459.         ADD_CLASS GHOSTCLASS,NewType
  460.       else
  461.         -- the choice is replace; replace foreign class with domestic one
  462.         put TheReplace into item THERECLASS of bg fld "Class"
  463.       end if
  464.     end if
  465.     if ADDONE then
  466.       add 1 to THERECLASS
  467.     end if
  468.   end repeat
  469. end CHECK_THIS_CARD
  470.  
  471. on CLEAR_THIS_CARD
  472.   global CURRENT_CARD,MAINSCREEN
  473.   put the short id of this card into SPELL_ID
  474.   put bg fld "Name" into SPELL_NAME
  475.   put bg fld "Level" into SPELL_LEVEL
  476.   put bg fld "Class" into CLASSES
  477.   repeat with COUNT=1 to the number of items of CLASSES
  478.     put item COUNT of CLASSES into TheCLASS
  479.     put TheCLASS&"Alphabetical" into NAME_FIELD
  480.     put TheCLASS&"AlphaLinkIDs" into ID_FIELD
  481.     put TheCLASS&&"Level"&&SPELL_LEVEL into LEVEL_FIELD
  482.     put LEVEL_FIELD&&"IDs" into LEVEL_ID_FIELD
  483.     get Delete_List(SPELL_NAME,SPELL_ID,NAME_FIELD,ID_FIELD)
  484.     get Delete_List(SPELL_NAME,SPELL_ID,LEVEL_FIELD,LEVEL_ID_FIELD)
  485.   end repeat
  486.   put "Level"&&SPELL_LEVEL into LEVEL_FIELD
  487.   put LEVEL_FIELD&&"IDs" into LEVEL_ID_FIELD
  488.   delete line CURRENT_CARD of bg fld "spell chooser" of cd id MAINSCREEN
  489.   delete line CURRENT_CARD of cd fld "spellid" of cd id MAINSCREEN
  490.   get Delete_List(SPELL_NAME,SPELL_ID,"Alphabetical","AlphaLinkIDs")
  491.   get Delete_List(SPELL_NAME,SPELL_ID,LEVEL_FIELD,LEVEL_ID_FIELD)
  492. end CLEAR_THIS_CARD
  493.  
  494. on CLEAR_ALL_LISTS
  495.   global MAX_LEVEL
  496.   push card
  497.   go to cd "Lists"
  498.   -- put empty into all
  499.   put empty into cd fld "alphabetical"
  500.   put empty into cd fld "alphalinkids"
  501.   put cd fld "Classes" into CLASSES
  502.   repeat with Count=1 to the number of lines of CLASSES -1
  503.     put item 1 of line Count of CLASSES into TheClass
  504.     put TheClass&"Alphabetical" into TheField
  505.     put empty into cd fld TheField
  506.     put TheClass&"AlphaLinkIDs" into TheField
  507.     put empty into cd fld TheField
  508.   end repeat
  509.   repeat with Count=1 to MAX_LEVEL
  510.     put "Level"&&Count into TheField
  511.     put empty into cd fld TheField
  512.     put TheField&&"IDs" into TheField
  513.     put empty into cd fld TheField
  514.     repeat with ClassNum=1 to the number of lines of CLASSES -1
  515.       put item 1 of line ClassNum of CLASSES into TheClass
  516.       put TheClass&&"Level"&&Count into TheField
  517.       put empty into cd fld TheField
  518.       put TheField&&"IDs" into TheField
  519.       put empty into cd fld TheField
  520.     end repeat
  521.   end repeat
  522.   pop card
  523. end CLEAR_ALL_LISTS
  524.  
  525. on ADD_CLASS NEW_CLASS,NEW_TYPE
  526.   global CURRENT_CLASS,MAX_LEVEL
  527.   put cd fld "Classes" of cd "Lists" into CLASSES
  528.   if CURRENT_CLASS is the number of lines of CLASSES then add 1 to CURRENT_CLASS
  529.   put last line of CLASSES into ALL_CLASS
  530.   put NEW_CLASS&","&NEW_TYPE into last line of CLASSES
  531.   put linesort( CLASSES) into CLASSES
  532.   if last char of CLASSES is not return then put return after CLASSES
  533.   put ALL_CLASS after CLASSES
  534.  
  535.   put CLASSES into cd fld "Classes" of cd "Lists"
  536.  
  537.   -- create sort fields for this class
  538.   set cursor to watch
  539.   lock screen
  540.   push card
  541.   go to cd "Lists"
  542.   put the userlevel into USER_LEVEL_SAVE
  543.   set the userlevel to 4
  544.   put the number of cd flds into FIELD_NUMBER
  545.   add 1 to FIELD_NUMBER
  546.   select cd fld "alphabetical"
  547.   domenu "copy field"
  548.   domenu "paste field"
  549.   set the name of cd fld FIELD_NUMBER to NEW_CLASS&"alphabetical"
  550.   add 1 to FIELD_NUMBER
  551.   select cd fld "alphalinkids"
  552.   domenu "copy field"
  553.   domenu "paste field"
  554.   set the name of cd fld FIELD_NUMBER to NEW_CLASS&"alphalinkids"
  555.   add 1 to FIELD_NUMBER
  556.   repeat with COUNT=1 to MAX_LEVEL
  557.     put "Level"&&COUNT into FIELD_NAME
  558.     select cd fld FIELD_NAME
  559.     domenu "copy field"
  560.     domenu "paste field"
  561.     set the name of cd fld FIELD_NUMBER to NEW_CLASS&&FIELD_NAME
  562.     add 1 to FIELD_NUMBER
  563.     put " IDs" after FIELD_NAME
  564.     select cd fld FIELD_NAME
  565.     domenu "copy field"
  566.     domenu "paste field"
  567.     set the name of cd fld FIELD_NUMBER to NEW_CLASS&&FIELD_NAME
  568.     add 1 to FIELD_NUMBER
  569.   end repeat
  570.   pop card
  571.   choose browse tool
  572.   unlock screen
  573. end ADD_CLASS
  574.  
  575. on RenewScreen CURTAIN
  576.   push card
  577.   go to cd id CURTAIN
  578.   unlock screen
  579.   lock screen
  580.   pop card
  581. end RenewScreen
  582.  
  583. on Do_The_Copy
  584.   domenu "Copy Card"
  585.   pop card
  586.   go last
  587.   type "v" with commandKey
  588. end Do_The_Copy
  589.  
  590. function Replacements IndexClass
  591. global REPLACE_LIST
  592. put 1 into Count
  593. repeat while Count<= the number of lines of REPLACE_LIST and item 2 of line Count of REPLACE_LIST is not IndexClass
  594.   add 1 to Count
  595. end repeat
  596. if Count> the number of lines of REPLACE_LIST then
  597.   put "Not Here" into TheResult
  598. else
  599.   put line Count of REPLACE_LIST into TheResult
  600.   delete item 2 of TheResult
  601. end if
  602. return TheResult
  603. end Replacements
  604.  
  605.  
  606.